Class_name = "CTurretRadioAI"
object_name = "CTurretRadioAI"

////brief burst small calibre
//////	Controller specific
Artificial=true;

ControlledType="GOT_VEHICLE_TURRET";

// formula for calculating the aiming error zone

// calculation formula
// axis_error (meters) = tan(
// random_number * (AddCoef + ProjSpeedCoef * speed_difference_in_area_of_aim (in meters per second) )
// * (current_overload * OverloadCoef + CoefLow/Hi/Ace)
// )
// * distance_to_target;
// random_number is a number between -1.0 and 1.0
// tan is the tangent. depending on the tangent of the error angle and the distance to the target, the resulting zone is obtained

// coefficient of conversion of the speed difference of the object on which the turret and targets stand, in the aiming plane, to the error angles
//comment: setting this from 0.2 to 0.08 seemed to have quite an impact on accuracy
//high value: speed difference causes high inaccuracy
//low value: gunner will always be a sniper and has perfect lead to target
ProjSpeedCoef = 0.042f;

// default aiming error factor
AddCoef = 0.05f;

// maximum overload in standard units at which the shooter stops aiming and shooting
MaxBotOverload = 3.0f;

// coefficient for converting overload into aiming units
//Comment: => this seems to be the effect on G forces, so how much the accuracy is affected by G-forces.
//High value: gunner is very inaccurate when plane is maneuvering.
//low value: gunner does not care about G forces at all
OverloadCoef = 0.07f;
// coefficient that multiplies by the initial radius when searching for a target
SearchDistanceMultiplier = 1.5f;

// coefficients for the dependence of the final firing area on the AI skill level
CoefLow		= 5.8f;
CoefMed		= 4.0f;
CoefHigh	= 2.0f;
CoefAce		= 0.65f;

// time for which the wrong sight passes from one point to another
// and time for which crosshair errors occur
// Comment: this is also a rather interesting factor, seems to affect the time how long it takes to correct, maybe that is causing the weird sweeping motions seen in the gifs??
ErrorCircleTime = 1.0f;
ErrorChangeTime = 0.25f;

// waiting time after aiming at the intended point, as if for more accurate aiming
MaxWaitTime = 0.1f;	

// coefficient by which the final error is multiplied to reduce it when firing at ground targets
GroundTargetErrorCoeff = 0.1f;

// coefficient by which the final error is multiplied to reduce it when firing at balloons
BalloonTargetErrorCoeff = 0.1f;

// shooting time - continuous queue, and then waiting time
FireShootTimeMin = 0.5f;
FireShootTimeMax = 0.5f;

FireWaitTimeMin = 1.0f;
FireWaitTimeMax = 2.0f;


// target search time, each period is checked, the more often - the more brakes naturally
//comment: this seems to be the factor how often the AI searches for targets
//high value: AI only will search for targets, start targeting every x seconds => if you put this to 5, the AI will react only every 5 seconds.. I have the feeling that 2 is too high value - the gunners seem to react very sluggish
//low value: AI will search for targets more often. I put this value to 0.1 once accidentally => made every gunner in the mission check for new targets every 0.1 seconds => totally killed my framerate
MaxSearchTime  = 0.75f;  

// the number of rounds sufficient to start shooting from afar (at triple range)
EnoughAmmoCount = 9999;

SearchDistanceLow   = 2.3f;
SearchDistanceMed   = 2.4f;
SearchDistanceHigh  = 2.5f;
SearchDistanceAce   = 2.6f;

SearchDistanceMinLow   = 2.0f;
SearchDistanceMinMed   = 2.0f;
SearchDistanceMinHigh  = 2.0f;
SearchDistanceMinAce   = 2.25f;

SearchDistanceAttackBalloon				= 1500.0f;
SearchDistanceAttackGround				= 1500.0f;
SearchDistanceShort						= 0.4;
SearchDistanceMedium					= 2.0;
BackFire3DAngle							= 30.0; 
BackFireDistance						= 600.0;
BackFirePlanePriorityType				= 2;
BackFireResetToDefaultTime				= 5.0;